<div class="row">
  <div class="col-xs-12">
    <div class="box box-primary">
      <div class="box-header">
        <h3 class="box-title">Keluarga</h3>
        <span class="box-title tmb-title">
        	<a href="<?php echo site_url('kepesertaan_keluarga/add')?>" class="btn btn-xs btn-primary btn-flat"><i class="ion-plus-round"></i>&nbsp;&nbsp;Tambah</button></a>
        </span>
        <div class="box-tools box-cari">
        <?=form_open('kepesertaan_keluarga/cari')?>
          <div class="input-group">
            <input type="text" name="keyword" value="<?=$this->session->userdata('keyword');?>"class="form-control input-sm pull-right" style="width: 150px;" placeholder="Cari Nomer KK..."/>
            <div class="input-group-btn">
              <button type="submit" name="submit" class="btn btn-sm btn-default btn-flat"><i class="fa fa-search"></i></button>
            </div>
          </div>
        <?=form_close();?>
      	</div>
      </div><!-- /.box-header -->
      <div class="box-body box-export-tools table-responsive">
      	<span class="notif notif-primary" <?php if(is_string($this->session->flashdata('sukses'))){echo 'style="display:block;"';}else{echo 'style="display:none;"';}?>>
      		<i class="fa fa-check"></i>
      		<?php echo $this->session->flashdata('sukses'); ?>
      		<button type="button" class="close">&times;</button>
      	</span>

      	<span class="notif notif-danger" <?php if(is_string($this->session->flashdata('gagal'))){echo 'style="display:block;"';}else{echo 'style="display:none;"';}?>>
      		<i class="fa fa-check"></i>
      		<?php echo $this->session->flashdata('gagal'); ?>
      		<button type="button" class="close">&times;</button>
      	</span>

      	<div class="pull-right">
        	<a href="<?php echo site_url('kepesertaan_keluarga/excel')?>" class="btn btn-xs btn-tbl btn-flat"><i class="fa fa-file-excel-o"></i>&nbsp;&nbsp;Save as Excel</button></a>
        </div>
        <table class="table table-hover table-condensed table-striped">
					<thead>
					<tr>
						<th style="text-align:center;" width="3%">#</th>
						<th>Nomer KK</th>
						<th>Kepala Keluarga</th>
						<th>Alamat</th>
						<th>RT</th>
						<th>RW</th>
						<th>Kelurahan</th>
						<th>Kecamatan</th>
						<th></th>
					</tr>
					</thead>
					<?php 
						if(!empty($results)){
							foreach ($results as $row) {
								?>
									<tr>
										<td align="center"><?php echo $ordinal_num++ ?></td>
										<td><?php echo $row['kd_kk']?></td>
										<td><?php echo kepala_keluarga($row['kd_kk']) ?></td>
										<td><?php echo $row['alamat']?></td>
										<td><?php echo $row['rt']?></td>
										<td><?php echo $row['rw']?></td>
										<td><?php echo $row['kelurahan']?></td>
										<td><?php echo $row['kecamatan']?></td>
										<td>
											<span class="pull-right">
												<?php echo anchor('kepesertaan_keluarga/edit/'.$row['kd_kk'].'','Edit','class="label label-warning" title="Edit data keluarga"'); ?>
												<?php echo anchor('kepesertaan_keluarga/delete/'.$row['kd_kk'].'','Hapus','class="label label-danger" title="Hapus data keluarga" onClick="return confirm(\'Yakin ingin menghapus '.$row['kd_kk'].' dari data keluarga?\');"'); ?>
											</span>
										</td>
									</tr>
								<?php 
							}
						}else{
					?>
					<tr>
						<td colspan="4" align="center">Tidak ada data</td>
					</tr>
					<?php
						}
					?>							
				</table>									
      </div><!-- /.box-body -->
      <div class="box-footer clearfix">
        <ul class="pagination pagination-sm no-margin pull-right">
          <?php echo $pagination; ?>
        </ul>        
      </div>
    </div><!-- /.box -->                            
  </div>
</div>